﻿using System;
using RockCorn.Objects;
using RockCorn.Interfaces;

namespace RockCorn.Internals
{
    class ShootableRacketEngine : Engine
    {
        public ShootableRacketEngine(IRenderer renderer, IUserInterface userInterface, int score)
            :base(renderer, userInterface, score)
        {
        }

        public ShootableRacketEngine(IRenderer renderer, IUserInterface userInterface, int sleepTime, int score)
            :base(renderer,  userInterface, sleepTime, score)
        {
        }

        public void ShootPlayerRacket()
        {
            if (playerRacket.GetType()==typeof(ShootingRacket)) // If current racket is shooting
            {
                ShootingRacket raket = (ShootingRacket)playerRacket;
                raket.Shoot();
            }
        }

        protected override void CheckGameOver()
        {
            if ((this.movingObjects.Count == 0) && (this.playerRacket as ShootingRacket).Bullets==0)
            {
                GameOver = true;
            }
        }
    }
}
